package com.goldenbean.test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.model.SelectItem;

import com.sun.org.apache.bcel.internal.generic.NEW;

@ManagedBean
@RequestScoped
public class Select {
	
	private boolean aggree;
	private String sex;
	private String edu;
	private String color;
	private String car;
	private String tel;
	private SelectItem[] colorSelectItems ;
	private List<SelectItem> cars = new ArrayList<SelectItem>();
	private Map phoneMap  = new HashMap<String, String>();
	
	

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public Map getPhoneMap() {
		phoneMap.put("诺基亚", "Nokia");
		phoneMap.put("摩托罗拉", "Moto");
		phoneMap.put("山寨机", "shangzhai");
		return phoneMap;
	}

	public void setPhoneMap(Map phoneMap) {
		this.phoneMap = phoneMap;
	}

	public String getCar() {
		return car;
	}

	public void setCar(String car) {
		this.car = car;
	}

	public List<SelectItem> getCars() {
		
		cars.add(new SelectItem("jeep","吉普车"));
		cars.add(new SelectItem("car","轿车"));
		cars.add(new SelectItem("bus","公车"));
		
		return cars;
	}

	public void setCars(List<SelectItem> cars) {
		this.cars = cars;
	}

	public SelectItem[] getColorSelectItems() {
		if (colorSelectItems == null) {
			colorSelectItems = new SelectItem[3];
			colorSelectItems[0] = new SelectItem("红");
			colorSelectItems[1] = new SelectItem("黄");
			colorSelectItems[2] = new SelectItem("蓝");
		}
		
		return colorSelectItems;
	}

	public void setColorSelectItems(SelectItem[] colorSelectItems) {
		this.colorSelectItems = colorSelectItems;
	}

	public boolean isAggree() {
		return aggree;
	}

	public void setAggree(boolean aggree) {
		this.aggree = aggree;
	}
	
	

	
	public String getEdu() {
		return edu;
	}

	public void setEdu(String edu) {
		this.edu = edu;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public void submit(){
		
		System.out.println("aggree : " + aggree);
		System.out.println("sex : " + sex);
		System.out.println("edu : " + edu);
		System.out.println("color : " + color);
		System.out.println("car : " + car);
		System.out.println("tel : " + tel);
		cars.clear();
	}
}
